package com.beiding.pojo.room;

import com.google.common.collect.Sets;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Set;

@Getter
@Setter
public class Price implements Serializable {


    public static final Set<Integer> ALLOWED_TIME_UNITS = Sets.newHashSet(Calendar.HOUR, Calendar.DAY_OF_MONTH, Calendar.MONTH, Calendar.YEAR);

    private int serial;

    private float price;
    private int timeUnit;
    private int num;
    private String text;

    @Override
    public String toString() {

        String unit=null;

        switch (timeUnit) {
            case Calendar.HOUR:
                unit = "小时";
                break;
            case Calendar.DAY_OF_MONTH:
                unit = "天";
                break;
            case Calendar.MONTH:
                unit = "月";
                break;
            case Calendar.YEAR:
                unit = "年";
                break;
        }

        String nS = "";
        if (num != 1) {
            nS = num + "";
        }

        String pS;
        int p = (int) price;

        if (p == price) {
            pS = p + "";
        } else {
            pS = price + "";
        }

        return pS + "元/" + nS + unit;
    }



    //押金
    private float deposit;


}
